package team.archai.nexus.boot.platform.basics.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;

/**
 * @author lishibin
 * @desc: 基础控制类
 * @date 2021-11-18
 */
@Getter
@Setter
@Schema(description = "基础业务模块传输参数")
public class BasicsEntity extends Model<BasicsEntity> {

    /**
     * 主键id
     */
    @TableId(type = IdType.ASSIGN_ID, value = "id")
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "主键")
    private Long id;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Schema(description = "创建时间")
    private LocalDate createTime;


    @TableField(value = "creator", fill = FieldFill.INSERT)
    @Schema(description = "创建人id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long creator;


    @TableLogic
    @Schema(description = "是否已删除")
    private Integer isDeleted;
}
